use std::collections::HashSet;

pub fn new_count_distinct(input_str: &str) -> usize {
    let mut words = HashSet::new();
    let mut word = String::new();

    for c in input_str.chars() {
        if c == ',' {
            words.insert(word.clone());
            word.clear();
        } else {
            word.push(c);
        }
    }

    if !word.is_empty() {
        words.insert(word);
    }

    words.len()
}
